<?php

namespace app\index\controller;

use think\Controller;
use think\View;
use app\index\model\Article;

class Articlelist extends Common
{

//    加载文章列表首页
    public function index()
    {

        $post = input('id');
//        dump($post);die;
        $fenlei = db('cate')->where('id',$post)->find();
//        dump($fenlei);die;


//        $article = db('article')->field('id,title,des')->select();
//        dump($article);die;
//        $this->assign('article',$article);
        $article = new Article();
        $allArticle = $article->getcatearticle(input('id'));
//        dump($haha);

//        根据分类id来找到分类名称


        $hotarticle = $article->gethotarticle(input('id'));
         $this->assign([
             'allArticle'=>$allArticle,
             'hotarticle'=>$hotarticle,
             'fenlei'=>$fenlei
         ]);
        return view('articlelist');
    }



}
